<?php
class ORMPackage extends ORMBase {
  public function __construct() {
    parent::__construct('Package');
  }

  public function __toEpObject($myManager, $epObject, $object) {
    require_once dirname(__FILE__) . '/ORMPackageItem.class.php';
    $epObject->trackId = isset($object->trackId) ? $object->trackId : '';
    $epObject->name = isset($object->name) ? $object->name : '';
    $epObject->price = isset($object->price) ? $object->price : 0;
    $epObject->hours = isset($object->hours) ? $object->hours : 0;
    $epObject->persons = isset($object->persons) ? $object->persons : 0;
    $epObject->makeup = isset($object->makeup) ? $object->makeup : '';
    $epObject->type = isset($object->type) ? $object->type : '';
    $epObject->orderInc = isset($object->orderInc) ? $object->orderInc : '';
    if (isset($epObject->packageItems)) {
      $epObject->packageItems->removeAll();
      foreach ($object->packageItems as &$item) {
        $epObject->packageItems[] = $this->__getEpObject_4_lvl_1_object($myManager, $item, new ORMPackageItem(), 'PackageItem');
      }
    }
    return $epObject;
  }

  public function __toObject($myManager, $epObject, $object) {
    require_once dirname(__FILE__) . '/ORMPackageItem.class.php';
    $object->id = $epObject->oid;
    $object->trackId = $epObject->trackId;
    $object->name = $epObject->name;
    $object->price = $epObject->price;
    $object->hours = $epObject->hours;
    $object->persons = $epObject->persons;
    $object->makeup = $epObject->makeup;
    $object->type = $epObject->type;
    $object->orderInc = $epObject->orderInc;
    $object->packageItems = array();
    if (isset($epObject->packageItems)) {
      foreach ($epObject->packageItems as &$item) {
        $object->packageItems[] = $this->__getObject_4_lvl_1_ep_object($myManager, $item, new ORMPackageItem());
      }
    }
    return $object;
  }
}
?>
